<!--我的借还-->
<html>
<head>
    <meta charset="utf-8">
    <title>我的借还</title>
    <script>
        $(function () {
            $.ajax({
                type:"post",
                dataType:"json",
                data:"",
                url:"user/personLog",
                success:function (data) {
                    var lis='';
                    $.each(data,function (index,ele) {
                        var lend_date=format(ele.lend_date);
                        var back_date=format(ele.back_date);
                        if(ele.back_date==null)
                        lis+='<tr><td>'+ele.book_id+'</td><td>'+lend_date+'</td><td></td><td>未还</td></tr>';
                        else
                            lis+='<tr><td>'+ele.book_id+'</td><td>'+lend_date+'</td><td>'+back_date+'</td><td>已还</td></tr>';
                    })


                    $("tbody:eq(0)").html(lis);
                }
            })
            function format(object) {
                var year = new Date(object).getFullYear(); //获取完整的年份(4位,1970-????)
                var month = new Date(object).getMonth() + 1; //获取当前月份(0-11,0代表1月)
                var day = new Date(object).getDate(); //获取当前日(1-31)
                if (month < 10) {
                    month = "0" + month;
                }
                if (day < 10) {
                    day = "0" + day;
                }
                var dateString =  year + "-" + month + "-" + day;
                return dateString;

            }
        })
    </script>
    <style>
        body{
            background-color: rgb(240,242,245);
        }
    </style>
</head>
<body>

<div style="position: relative;top: 10%">
   <!-- <c:if test="${!empty succ}">
        <div class="alert alert-success alert-dismissable">
            <button type="button" class="close" data-dismiss="alert"
                    aria-hidden="true">
                &times;
            </button>
                ${succ}
        </div>
    </c:if>
    <c:if test="${!empty error}">
        <div class="alert alert-danger alert-dismissable">
            <button type="button" class="close" data-dismiss="alert"
                    aria-hidden="true">
                &times;
            </button>
                ${error}
        </div>
    </c:if>-->
</div>

<div class="panel panel-default" style="width: 90%;margin-left: 5%;margin-top: 5%">
    <div class="panel-heading">
        <h3 class="panel-title">
            我的借还日志
        </h3>
    </div>
    <div class="panel-body">
        <table class="table table-hover">
            <thead>
            <tr>
                <th>图书号</th>
                <th>借出日期</th>
                <th>归还日期</th>
                <th>状态</th>
            </tr>
            </thead>
            <tbody>
            <!--<c:forEach items="${list}" var="alog">
                <tr>
                    <td><c:out value="${alog.bookId}"></c:out></td>
                    <td><c:out value="${alog.lendDate}"></c:out></td>
                    <td><c:out value="${alog.backDate}"></c:out></td>
                    <c:if test="${empty alog.backDate}">
                        <td>未还</td>
                    </c:if>
                    <c:if test="${!empty alog.backDate}">
                        <td>已还</td>
                    </c:if>
                    <c:if test="">
                        <td>超期</td>
                    </c:if>
                </tr>
            </c:forEach>-->
            </tbody>
        </table>
    </div>
</div>

</body>
</html>
